package mst

import "sort"

func CheckPermutation(s1 string, s2 string) bool {
	rMap := make([]int, 0)
	rMap2 := make([]int, 0)
	l := len(s1)
	l2 := len(s2)
	if l != l2 {
		return false
	}
	for i:=0; i<l; i++ {
		rMap = append(rMap, int(s1[i]))
		rMap2 = append(rMap2, int(s2[i]))
	}
	sort.Ints(rMap)
	sort.Ints(rMap2)
	p1 := 0
	p2 := len(rMap) -1
	for p1<p2  {
		if rMap[p1] == rMap2[p1] && rMap[p2] == rMap2[p2] {
			p1++
			p2--
		}else {
			return false
		}
	}

	return true
}

func CheckPermutation1(s1 string, s2 string) bool {

	return false
}